/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2011
 */

package com.tech15.core.service;

import java.util.Map;

import javacommon.base.BaseManager;
import javacommon.base.EntityDao;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.org.rapid_framework.page.Page;

import com.tech15.core.dao.ModuleFunctionDao;
import com.tech15.core.model.ModuleFunction;
import com.tech15.core.vo.query.ModuleFunctionQuery;

/**
 * @author 胡作正 email:zuozhenghu@sina.com
 * @version 1.0
 * @since 1.0
 */

@Service
@Transactional
public class ModuleFunctionManager extends BaseManager<ModuleFunction,Long>{

	private ModuleFunctionDao moduleFunctionDao;
	/**增加setXXXX()方法,spring就可以通过autowire自动设置对象属性,请注意大小写*/
	public void setModuleFunctionDao(ModuleFunctionDao dao) {
		this.moduleFunctionDao = dao;
	}
	public EntityDao getEntityDao() {
		return this.moduleFunctionDao;
	}
	
	@Transactional(readOnly=true)
	public Page findPage(ModuleFunctionQuery query) {
		return moduleFunctionDao.findPage(query);
	}
	/**
	 * 判断是否拥有此功能
	 * @param userid
	 * @param url
	 * @return
	 */
	@Transactional(readOnly=true)
	public boolean isHasFunction(Long userid,String url){
		int count = moduleFunctionDao.isHasFunction(userid, url);
		if(count>0){
			return true;
		}else{
			return false;
		}
	}
	
	/**
	 * 判断系统管理员是否拥有此功能
	 * @param userid
	 * @param url
	 * @return
	 */
	@Transactional(readOnly=true)
	public boolean isHasAdminFunction(String url){
		int count = moduleFunctionDao.isHasAdminFunction(url);
		if(count>0){
			return true;
		}else{
			return false;
		}
	}
}
